<html>
<head>
  <script src="../../../dojo.js"></script>
  <script>
	// dojo.i18n is always loaded as part of base on the xdomain build
	dojo.require("dojo.i18n");

    // now put the loader in xdomain mode; anything with amd will be detected to be xdomain
	require.xdomainTest(function(name){
		return /amd/.test(name);
	});

    // load the module that exercises all the load paths; keep a log of what happened
	var dojoCdnTestLog= [];
	dojo.require("dojo.testsDOH._base.loader.cdnTest");
	dojoCdnTestLog.push("after dojo.require(dojo.testsDOH._base.loader.cdnTest)");
	require(["dojo", "doh"], function(dojo, doh){
		doh.register("cdn-test", [
			function(t){
				var expected= [
					"loadInit in cdnTest",
					"defining-dojo.testsDOH._base.loader.amdModule1",
					"defining-dojo.testsDOH._base.loader.amdModuleDep1",
					"in-dojo.testsDOH._base.loader.syncModuleDep",
					"out-dojo.testsDOH._base.loader.syncModuleDep",
					"in-dojo.testsDOH._base.loader.syncModule",
					"out-dojo.testsDOH._base.loader.syncModule",
					"after dojo.require(dojo.testsDOH._base.loader.cdnTest)",
					"defining-dojo.testsDOH._base.loader.amdModule",
					"defining-dojo.testsDOH._base.loader.amdModuleDep",
					"factory-dojo.testsDOH._base.loader.amdModuleDep",
					"factory-dojo.testsDOH._base.loader.amdModule",
					"in-dojo.testsDOH._base.loader.cdnTest",
					"in-dojo.testsDOH._base.loader.syncModuleDep1",
					"out-dojo.testsDOH._base.loader.syncModuleDep1",
					"in-dojo.testsDOH._base.loader.syncModule1",
					"out-dojo.testsDOH._base.loader.syncModule1",
					"factory-dojo.testsDOH._base.loader.amdModuleDep1",
					"factory-dojo.testsDOH._base.loader.amdModule1",
					"out-dojo.testsDOH._base.loader.cdnTest"];
				t.is(dojoCdnTestLog, expected);
				t.is(dojo.testsDOH._base.loader.syncModule.status, "OK");
				t.is(dojo.testsDOH._base.loader.syncModuleDep.status, "OK");
				t.is(dojo.testsDOH._base.loader.syncModule1.status, "OK");
				t.is(dojo.testsDOH._base.loader.syncModuleDep1.status, "OK");
				t.is(require("dojo/testsDOH/_base/loader/amdModule").status, "OK");
				t.is(require("dojo/testsDOH/_base/loader/amdModuleDep").status, "OK");
				t.is(require("dojo/testsDOH/_base/loader/amdModule1").status, "OK");
				t.is(require("dojo/testsDOH/_base/loader/amdModuleDep1").status, "OK");	

				t.is(dojo.testsDOH._base.loader.syncModule2, undefined);
				t.is(dojo.testsDOH._base.loader.syncModuleDep2, undefined);
				t.is(require("dojo/testsDOH/_base/loader/amdModule2"), undefined);
				t.is(require("dojo/testsDOH/_base/loader/amdModuleDep2"), undefined);
				t.is(dojo.i18n.getLocalization("dojo.testsDOH._base.loader", "syncBundle").syncBundle, "syncBundle");
				t.is(dojo.i18n.getLocalization("dojo.testsDOH._base.loader", "syncBundle", "ab-cd-ef").syncBundle, "syncBundle-ab-cd-ef");
				t.is(dojo.i18n.getLocalization("dojo.testsDOH._base.loader", "amdBundle").amdBundle, "amdBundle");
				t.is(dojo.i18n.getLocalization("dojo.testsDOH._base.loader", "amdBundle", "ab-cd-ef").amdBundle, "amdBundle-ab-cd-ef");
			}
		]);
		doh.runOnLoad();
		dojo.ready(function(){
			dojo.byId("done").innerHTML= dojoCdnTestLog.join("<br>");

		});


	});
  </script>
</head>
<body>
  <div id="done"></div>
</body>
</html>
